<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>
    <link href="<?php echo WEBCSS . '/style.css'; ?>" rel="stylesheet">
    <link href="<?php echo WEBCSS . '/common.css'; ?>" rel="stylesheet">
    <script type="text/javascript" src="<?php echo WEBJS . '/jquery.js'; ?>"></script>
</head>
<body class="login-bg">
<div class="titleImg" style="padding-top: 40px;"><img src="<?php echo WEBIMG ?>/login_icon.png"/></div>
<div class="titleImg"><img src="<?php echo WEBIMG ?>/login_text.png"/></div>

<div class="loginName">
    <img src="<?php echo WEBIMG ?>/login_username.png" class="img-middle">
    <input class="input" id="userName" type="text" placeholder="请输入账号" maxlength="30" required>
    <a href="javascript:" class="clear"></a>
</div>

<div class="loginPwd">
    <img src="<?php echo WEBIMG ?>/login_pwd.png" class="img-middle">
    <input class="input" id="userPwd" type="password" placeholder="请输入密码" maxlength="30" required>
    <a href="javascript:" class="clear"></a>
</div>
<div style="text-align:center;">
    <input id="btn" class="loginBtn" type="button" value="登录">
</div>

<div class="login-width div-center">
    <div class="flt">立即试用</div>
    <div class="frt">忘记密码？</div>
</div>
<div id="tip" class="tip"></div>
<div class="login-bottom">
    <img src="<?php echo WEBIMG ?>/login_call_icon.png" class="img-middle" style="padding-right: 3%;"/><a
            href="tel:4000285927">4000285927</a>
</div>
<script type="text/javascript">
    function Tip(msg) {
        $("#tip").html(msg);
        $('#tip').stop().fadeIn().delay(2500).fadeOut();
    }
    $('#btn').click(function () {
        var userName = $('#userName').val();
        var userPwd = $('#userPwd').val();
        //validate 去空，不能是标签
        if (userName == "" || userPwd == "") {
            Tip('账号或密码为空');
            return false;
        }
        $.ajax({
            type: "post",
            url: "<?php echo WEBROOT . '/welcome/runLogin/'; ?>",
            dataType: 'json',
            data: {'userName': userName, 'userPwd': userPwd},
            success: function (info) {
                var code = info.code;
                var msg = info.message;
                if (code == 200) {
                    Tip(msg);
                    window.location.href = '<?php echo WEBROOT.'/home/index/';?>';
                } else {
                    Tip(msg);
                    return false;
                }
            },
            error: function () {
                Tip('网络错误！');
                return false;
            }
        });
    });
</script>
</body>
</html>
